import 'package:bookapp/containers/setting.dart';
import 'package:bookapp/containers/entrance.dart';
import 'package:bookapp/containers/detail.dart';
import 'package:bookapp/containers/book_detail.dart';
import 'package:bookapp/containers/login.dart';
import 'package:bookapp/containers/register.dart';
import 'package:bookapp/containers/search.dart';
import 'package:bookapp/containers/leader_board.dart';
import 'package:bookapp/containers/category.dart';
import 'package:bookapp/containers/about_us.dart';
import 'package:bookapp/containers/splash_page.dart';

// import 'package:flutter/painting.dart';
import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:bookapp/helpers/fluro_convert_util.dart';

Handler rootHandler = Handler(
    handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
      return Entrance();
    });

// 我的设置路由
Handler settingRouteHandler = Handler(
    handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
      // String message = params["message"]?.first;
      // String colorHex = params["color_hex"]?.first;
      return Setting();
    });

// 书籍列表
Handler detailRouterHandler = Handler(
    handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
      return Detail(
          title: FluroConvertUtils.fluroCnParamsDecode(params["title"]!.first),
          type: params['type']!.first);
    });

// 书籍详情路由
Handler bookDetailRouterHandler = Handler(
    handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
      return BookDetail();
    });

// 登录
Handler loginRouterHandler = Handler(
    handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
      return Login();
    });

// 注册
Handler registerRouterHandler = Handler(
    handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
      return Register();
    });
// 搜索
Handler searchRouterHandler = Handler(
    handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
      return Search();
    });
// 排行榜
Handler leaderboardRouterHandler = Handler(
    handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
      return Leaderboard();
    });
// 类别
Handler categoryRouterHandler = Handler(
    handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
      return Category();
    });

// 关于我们
Handler aboutUsRouterHandler = Handler(
    handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
      return AboutUs();
    });

// 闪屏
Handler splashRouterHandler = Handler(
    handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
      return SplashPage();
    });

